Skip to content

feature(CI): Run the live tests, raw data included, against staging on dispatch - #22

Merged
szemyd merged 2 commits into
mainfrom
claude/dreamy-dijkstra-4g5vlk
Oct 1, 2026
Merged

szemyd merged 2 commits into
mainfrom
claude/dreamy-dijkstra-4g5vlk

Conversation

@szemyd

@szemyd szemyd commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Why

The router's data bump runs the client SDK's tests against staging before every aperiodic.io release, but not the CLI's. dream-faster/unravel-router#884 now dispatches this repo's ci.yml as well. For that to work, the CLI needs a way to be pointed at staging, and it needs live tests for raw data.

Changes

  • The live tests honour APERIODIC_API_URL. requireAPIKey used to force production. It now calls a new useLiveAPI(t): production unless APERIODIC_API_URL names another API. The invalid-key tests use it too, so a staging run doesn't touch production.
  • raw_live_test.go, end to end against the live API, with the June 2025 BTC perpetual files:
    • raw coverage has a summary row for each of the six datasets;
    • raw coverage --dataset trades --exchange binance-futures --symbol … shows one row spanning June 2025;
    • raw funding_rate --preview with no key writes a Parquet file (PAR1 at both ends) at the Hive path;
    • DEMO-KEY outside the preview exits 1 with a 401;
    • with APERIODIC_API_KEY: raw trades downloads the June file, and a second run reports Skipping 1 already present. This is the one large transfer (the trades month, a few hundred MB).
  • ci.yml takes workflow_dispatch with a base_url. A dispatched run uses APERIODIC_STAGING_API_KEY and the Cloudflare Access token. It fails up front if any of those three secrets is missing: a missing staging key would silently fall back to the production one, and missing Access credentials would fail every request. Push and PR runs still test production with APERIODIC_API_KEY.

One key per environment: the paid raw download uses the same APERIODIC_API_KEY as every other live test, with no separate raw key. So the key in use (production, or staging when dispatched) must be on Prime + Raw. Until the production key is upgraded, the paid download fails on push and PR runs with a 403 raw_not_in_plan.

Needed before the next data bump

  • Upgrade the accounts behind APERIODIC_API_KEY and APERIODIC_STAGING_API_KEY to Prime + Raw. If the staging one is a seeded router e2e account whose tier the router's specs depend on (scripts/seed-staging-accounts.ts; e.g. e2e+prime must get raw_not_in_plan), point the secret at e2e+primeraw instead.
  • Set APERIODIC_STAGING_API_KEY, CF_ACCESS_CLIENT_ID and CF_ACCESS_CLIENT_SECRET on this repo (or at org level): the same values aperiodic-io/client uses.

Merge this before the router PR: until it lands, ci.yml on main has no base_url input to dispatch.

Verified

  • gofmt -l . is clean, go vet ./... passes, and the offline tests pass.
  • The first push's CI passed on all three OSes against production, including the four keyless raw tests. On Windows that included a real download to the escaped-colon path.
  • The sandbox can't reach aperiodic.io, so I checked the paid download against a local stub of the router's raw endpoints, with only APERIODIC_API_KEY set. It has not yet run against a real Prime + Raw key.
  • actionlint on ci.yml: clean.

Spotted, not fixed here

Since unravel-router#879 (live in data-v1.3.13), /metadata/raw no longer sends bytes or missing. So aperiodic raw coverage now prints 0 B in SIZE and 0 in MISSING on every row. The new tests don't assert those columns.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CkNoeMr2UCifeweNbR8R25

claude added 2 commits October 1, 2026 14:35
…n dispatch

The live tests were pinned to production, so the router could not point
them at staging. They now honour APERIODIC_API_URL, and ci.yml takes a
base_url on workflow_dispatch with the staging keys, which the router's
data bump uses as a release gate.

raw_live_test.go adds raw data end to end: coverage (summary and one
symbol), the preview with no key, DEMO-KEY refused outside the preview,
and, with APERIODIC_RAW_API_KEY, a paid download of the June 2025 trades
file followed by a run that skips it. A dispatched run fails up front if a
staging secret is missing, so a release cannot pass with the raw test
skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CkNoeMr2UCifeweNbR8R25
…e one

The paid raw download read APERIODIC_RAW_API_KEY, so each environment
needed a second key. It now uses APERIODIC_API_KEY like the other live
tests, so that key (production, or staging when dispatched) has to be on
the Prime + Raw plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CkNoeMr2UCifeweNbR8R25

szemyd commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Red on 24420f1: blocked on an account plan, not code.

Test (ubuntu-latest) fails on one test, TestCLI_Raw_Live_DownloadsAndThenSkipsTheJuneFile:

Error: Raw data is not included in the prime plan. It is part of Prime + Raw.
Raw data needs the Prime + Raw plan: https://aperiodic.io/pricing

Since this commit, the paid raw download uses the repo's existing APERIODIC_API_KEY, with no separate raw key. On push and PR runs that is the production key, and its account is on Prime. Every other test passes, including the four keyless raw ones.

To get green: upgrade the account behind APERIODIC_API_KEY to Prime + Raw, then re-run this check. Do the same for the account behind APERIODIC_STAGING_API_KEY before the next data bump. This is what we expect a real user to hit, so I'm not skipping or loosening the test.


Generated by Claude Code

@szemyd
szemyd merged commit 430967f into main Oct 1, 2026
26 of 50 checks passed
@szemyd
szemyd deleted the claude/dreamy-dijkstra-4g5vlk branch October 1, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants